/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sample;

import test.test;
import test.Some;
import test.Other;
/**
 *
 * @author Administrator
 */
public class MultiChat {
    
    public static void main(String[] args) {
        
        Client c1 = new Client("10.01.10", "zhangsan");
        Client c2 = new Client("192.168.1.1", "lisi");
    
        ClientQueue queue = new ClientQueue();
        queue.addClientListener(new ClientListener() {
            @Override
            public void clientAdded(ClientEvent event) {
                System.out.println(event.getName() + "从" + event.getIp() + "联机");
            }

            @Override
            public void clientRemoved(ClientEvent event) {
                System.out.println(event.getName() + "从" + event.getIp() + "脱机");
            }
        });
        
        queue.add(c1);
        queue.add(c2);
        queue.remove(c1);
        queue.remove(c1);
        
        play(Action.Stop);
        Some s = new test(){
            public void haha(){
                System.out.println("haha");
            }
            public void hehe(){
                System.out.println("hehe");}
        };
        s.doSome();
        s.haha();
        System.out.println(""+s.x);
        Other o = (Other) s;
        o.doOther();
        
    }
    
    public static void play(Action action){
        switch(action){
            case Stop:
                System.out.println("sample.MultiChat.play().stop");
                break;
            case up:
                System.out.println("up");
                break;
        }
    }

}